import { Component, OnInit,Input } from '@angular/core';
import {ModalController} from '@ionic/angular';
import {FaciltyPage} from './facilty.page';

@Component({
  selector: 'app-support-facilities',
  templateUrl: './support-facilities.component.html',
  styleUrls: ['./support-facilities.component.scss']
})
export class SupportFacilitiesComponent implements OnInit {

  @Input()
  facilties:any;

  fourFacilties:any;

  constructor(private modalCtrl: ModalController) { }

  ngOnInit() {
    this.fourFacilties = this.facilties.length>4?this.facilties.slice(0,4):this.facilties;
    
  }

  // 打开图片展示框，滑动展示
  async openModal() {
    const that = this;
    const modal = await this.modalCtrl.create({
        component: FaciltyPage,
        componentProps: {value: JSON.stringify(this.facilties)}
      });
    return await modal.present();
  }
}
